"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var Animal = (function () {
    function Animal(name, color, _age, type) {
        this.name = name;
        this.color = color;
        this._age = _age;
    }
    Object.defineProperty(Animal.prototype, "age", {
        get: function () {
            return this._age;
        },
        set: function (value) {
            if (value < 0 || value > 150)
                throw new Error("年龄不符合规范...");
            this._age = value;
        },
        enumerable: false,
        configurable: true
    });
    Animal.showKingdom = function () {
        console.log(Animal.kingdom);
        console.log(this.kingdom);
        return "The Kingdom is ".concat(Animal.kingdom);
    };
    Animal.prototype.show = function () {
        console.log(this.name, this.color, this._age);
    };
    Animal.kingdom = "Animal";
    return Animal;
}());
var Cat = (function (_super) {
    __extends(Cat, _super);
    function Cat() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Cat.prototype.info = function () {
        console.log(this.name);
        this.show();
        console.log(this.name);
        this.show();
    };
    return Cat;
}(Animal));
var a = new Animal("小白", "白色", 3, "Dog");
console.log(a.name);
a.show();
var s = Animal.showKingdom();
console.log(s);
var c = new Cat("小猫", "花色", 2, "Cat");
console.log(c.name);
c.info();
